package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
public interface UserMapper {

    /**
     * @MethodName: getByOpenId
     * @Author 冰白寒祭
     * @Description: 根据openid查询用户
     * @Date: 2023-09-03 22:17:09
     * @param: String openid
    * @return: User
    */
    @Select("select * from user where openid = #{openid}")
    User getByOpenId(String openid);

    /**
     * @MethodName: insert
     * @Author 冰白寒祭
     * @Description: 插入用户
     * @Date: 2023-09-03 22:21:29
     * @param: User user
    */
    void insert(User user);

    @Select("select * from user where id = #{id}")
    User getById(Long userId);

    /**
     * 根据动态条件统计用户数量
     * @param map
     * @return
     */
    Integer countByMap(Map map);
}
